
package com.dingli.shop.controller;

import com.dingli.shop.biz.RightsBiz;
import com.dingli.shop.po.RightsVO;
import com.dingli.shop.vo.JsonVo;
import com.dingli.shop.vo.Meta;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@CrossOrigin
@RequestMapping("/rights")
@Controller
public class RightsController {
    @Autowired
    private RightsBiz rightsBiz;

     @GetMapping("/list")
    public @ResponseBody
     JsonVo list() {
        List<RightsVO> rightsVOList = rightsBiz.findRights();
        Meta meta = new Meta();
        if ( rightsVOList== null) {
            meta.setMsg("没有找到权限列表");
            meta.setStatus(400);
        } else {
            meta.setMsg("获取权限列表成功");
            meta.setStatus(200);
        }
        JsonVo jsonVo = new JsonVo();
        jsonVo.setData(rightsVOList);
        jsonVo.setMeta(meta);
        return jsonVo;
    }



}
